package com.dengqi.mymodule.activity.touch;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.dengqi.mymodule.BaseActivity;
import com.dengqi.mymodule.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Author: deng
 * Date: 2020/10/23
 * Description: 事件拦截：https://blog.csdn.net/jinmie0193/article/details/80786797
 */
public class TouchActivity extends BaseActivity {


    @BindView(R.id.viewC)
    ViewC viewC;
    @BindView(R.id.layoutB)
    LinearLayoutB layoutB;
    @BindView(R.id.layoutA)
    LinearLayoutA layoutA;
    @BindView(R.id.tv_content)
    TextView tvContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_touch);
        ButterKnife.bind(this);

    }

    @OnClick({R.id.btn1, R.id.btn2, R.id.btn3, R.id.btn4})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.btn1:
                tvContent.setText("LinearLayoutA: \n" +
                        "\tdispatchTouchEvent0\n" +
                        "\tonInterceptTouchEvent0\n" +
                        "LinearLayoutB: \n" +
                        "\tdispatchTouchEvent0\n" +
                        "\tonInterceptTouchEvent0\n" +
                        "ViewC: \n" +
                        "\tdispatchTouchEvent0\n" +
                        "\tonTouchEvent0\n" +
                        "LinearLayoutB: \n" +
                        "\tonTouchEvent0\n" +
                        "LinearLayoutA: \n" +
                        "\tonTouchEvent0");
                break;
            case R.id.btn2:
                tvContent.setText("LinearLayoutA: \n" +
                        "\tdispatchTouchEvent0\n" +
                        "\tonInterceptTouchEvent0\n" +
                        "LinearLayoutB: \n" +
                        "\tdispatchTouchEvent0\n" +
                        "\tonInterceptTouchEvent0\n" +
                        "ViewC: \n" +
                        "\tdispatchTouchEvent0\n" +
                        "\tonTouchEvent0\n" +
                        "LinearLayoutA: \n" +
                        "\tdispatchTouchEvent1\n" +
                        "\tonInterceptTouchEvent1\n" +
                        "LinearLayoutB: \n" +
                        "\tdispatchTouchEvent1\n" +
                        "\tonInterceptTouchEvent1\n" +
                        "ViewC: \n" +
                        "\tdispatchTouchEvent1\n" +
                        "\tonTouchEvent1");
                break;
            case R.id.btn3:
                tvContent.setText("LinearLayoutA: \n" +
                        "\tdispatchTouchEvent0  \n" +
                        "\tonInterceptTouchEvent0\n" +
                        "LinearLayoutB: \n" +
                        "\tdispatchTouchEvent0\n" +
                        "\tonInterceptTouchEvent0\n" +
                        "ViewC: \n" +
                        "\tdispatchTouchEvent0\n" +
                        "\tonTouchEvent0\n" +
                        "LinearLayoutA: \n" +
                        "\tdispatchTouchEvent1\n" +
                        "LinearLayoutB: \n" +
                        "\tdispatchTouchEvent1\n" +
                        "ViewC: \n" +
                        "\tdispatchTouchEvent1\n" +
                        "    onTouchEvent1\n");
                break;
            case R.id.btn4:
                break;
        }
    }
}
